<?php
session_start();
$currentUser = $_SESSION["user"];

$title = $_POST["Title"];
$content = $_POST["Content"];
$authorId = $currentUser["Id"]."dfdfdf";
$authorName = $currentUser["Username"];
$now = date_format(new DateTime(),'Y-m-d H:i:s');


//php 字符串 "",''?有什么不一样的？
//mysql `` 反引号 什么意思？ 用户定义的字段或表名，无论它是不是关键字
// mysql ''单引号
$sql = "INSERT INTO `Article` 
(`Title`,`Content`,`AuthorId`,`AuthorName`,`CreateTime`,`UpdateTIme`)
VALUES
('$title','$content','$authorId','$authorName','$now','$now')
";
var_dump($sql);

$conn = new mysqli("localhost",'root','','myblog');
$conn->query($sql);
if($conn->error) echo $conn->error;
else {
    echo "添加成功,<a href=''>跳转到列表</a>";
}